1. Field of the Invention
The present invention relates to a magnetic-sensor controller, a magnetism measurement apparatus, an offset setting method, and a computer-readable medium on which an offset setting program is recorded.
2. Description of the Related Art
A conventionally known three-dimensional magnetic sensor mounted on a movable body and adapted to detect the direction of geomagnetism typically includes a magnetic sensor module which detects a magnetic field vector as components in three directions intersecting orthogonally to one another. The direction and size of a vector whose components are represented by magnetic data, which are the output of the three-dimensional magnetic sensor, are the direction of and strength of a magnetic field detected by the three-dimensional magnetic sensor. When the direction or strength of the geomagnetism is determined on the basis of the output of the three-dimensional magnetic sensor, the output includes a component attributable to magnetism of the movable body and a measurement error of the magnetic sensor itself. Accordingly, processing must be performed for correcting the output of the three-dimensional magnetic sensor to cancel out the component and the error. The value for the correction processing is called “offset.” This offset represents a magnetic field vector associated with the magnetism of the movable body which the three-dimensional magnetic sensor detects while involving the measurement error of the magnetic sensor. The component attributable to the magnetism of the movable body and the measurement error of the magnetic sensor are canceled out altogether by subtracting the offset from the magnetic data, which are the output of the three-dimensional magnetic sensor. In a three-dimensional coordinate space, a point represented by the magnetic data is plotted along a predetermined spherical surface. The offset can be calculated by obtaining the center of the spherical surface. The processing for obtaining the offset is called calibration.
Incidentally, even when magnetic data necessary for calculation of the offset are measured, a set of points represented by the magnetic data does not form a complete spherical surface, because of, for example, the measurement error of the three-dimensional magnetic sensor itself, a variation in the magnetic field during the measurement period, or a calculation error produced when the output of the three-dimensional magnetic sensor is converted to digital values. International Application Laid-Open No. WO2004-003476 discloses a technique for statistically estimating a point which minimizes the variation in distance between that point and a plurality of points represented by a plurality of sets of obtained magnetic data. The three-dimensional magnetic sensor enables calibration to be performed without forcing a user to intentionally rotate the movable body on a plane. Therefore, it is not necessary to provide a guide to the user on how to move the movable body during the calibration. Therefore, it is very likely that the strength of the magnetic field acting on the movable body varies during the calibration. For example, when the measurement errors, etc. are assumed to be neglected, each of points represented by magnetic data measured while the user has been walking are theoretically located on each of spherical surface whose radius corresponds to the strength of the magnetic field at the time when the respective magnetic data were measured. Thus, the points are not located on a common spherical surface having a fixed radius. Therefore, the method disclosed in the publication has a problem in that the position estimated as the center of the sphere involves a large error.